package day1105.second;

import day1105.common.MyUtil;
import day1105.common.Student;

import java.util.List;

import static day1105.common.MyUtil.printLine;

/**
 * @author Mr.ma
 * @since 2022/11/6 15:09
 **/
public class FilterTest {
    public static void main(String[] args) {
        List<Student> studentList = MyUtil.createStudentList();
        studentList.stream().forEach(System.out::println);
        printLine("查找成绩在70分以上的学生");
        studentList.stream().filter(x -> x.getScore().compareTo(70.0) > 0).sorted((x1,x2) -> x1.getScore().compareTo(x2.getScore())).forEach(System.out::println);
        printLine("查找一班成绩在70分以上的学生");
        studentList.stream().filter(x -> "一班".equals(x.getClazz()))
                .filter(x -> x.getScore().compareTo(70.0) > 0)
                .sorted()
                .forEach(System.out::println);
    }
}
